//
//  HRTabBarItem.swift
//  microBlog
//
//  Created by HR_W on 16/5/27.
//  Copyright © 2016年 admin. All rights reserved.
//

import UIKit

class HRTabBarItem: UITabBarItem {

    override var badgeValue: String?{
    
        didSet {
            let target = valueForKey("_target") as! HRMainViewController
            for subView in target.tabBar.subviews{
            
                if subView.isKindOfClass(NSClassFromString("UITabBarButton")!) {
                    for v in subView.subviews {
                        if v.isKindOfClass(NSClassFromString("_UIBadgeView")!) {
                            for bgView in v.subviews{
                                if bgView.isKindOfClass(NSClassFromString("_UIBadgeBackground")!) {
                                    let image = UIImage(named: "tabbar_compose_button")
                                    bgView.setValue(image, forKey: "_image")
                                    
                                }
                            
                            }
                        }
                    }
                }
            
            }
        
        
        }
    
    }
    
    
    
}
